<?php
//汽车
class Car {
    protected $parts;
    public function create() {
        $this->setParts('engine', new Engine());
        $this->setParts('ldoor', new Door());
        $this->setParts('rdoor', new Door());
        $this->setParts('wheel1', new Wheel());
        $this->setParts('wheel2', new Wheel());
        $this->setParts('wheel3', new Wheel());
        $this->setParts('wheel4', new Wheel());
    }
    public function setParts($key, $value)
    {
        $this->parts[$key] = $value;
    }
}